package com.madou.yy.football;

import java.io.File;

public class ResourcesUtil {

    /**获取到项目的跟路径
     *
     * @return
     */
    public static String getRootPath(){
        String path = ResourcesUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
        File file = new File(path);
        System.out.println(path+"\t"+file.isDirectory());
        // 打包好的环境,得到的是exe所在路径
        if(file.isFile()){
            path = file.getParentFile().getAbsolutePath();
        }else{
            path = file.getParentFile().getParent();
        }
        System.out.println(path+"\t你项目运行的路径");
        return path+"\\static";
    }

}
